#include<bits/stdc++.h>
using namespace std;
int n,a[100010],mp[100010],mn=1e9,id,f[100010];
int check(int x){
	int res=0;
	for(int i=n;i>=1;i--){
		int num=i-mp[i]+f[i];
		res+=num/x+num%x; 
	}
	return res;
}
void solve(int x){
	for(int i=n;i>=1;i--){
		int num=i-mp[i]+f[i],now=mp[i]-f[i];
		for(int j=1;j<=num/x;j++)cout<<"1 "<<now<<"\n",now+=x;
		for(int j=1;j<=num%x;j++)cout<<"2 "<<now<<"\n",now+=1;
	}
}
int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	freopen("rotate.in","r",stdin);
	freopen("rotate.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i],mp[a[i]]=i;
	for(int i=n;i>=1;i--)for(int j=mp[i]-f[i]+1;j<=i;j++)f[a[j]]++,swap(a[j],a[j-1]);
	for(int i=2;i<=n;i++){
		int opt=check(i);
		if(opt<=1900000){
			cout<<i<<" "<<opt<<"\n";
			solve(i);
			return 0;
		}
	}
	return 0;
}
